package com.dcy;

import com.dcy.dao.StudentDao;
import com.dcy.domain.Student;
import com.dcy.utils.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.ArrayList;
import java.util.List;

//这个测试的是foreach运用于简单类型的List集合
public class Starter03 {
    public static void main(String[] args) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession();
        StudentDao studentDao = sqlSession.getMapper(StudentDao.class);
        List<Integer> idList=new ArrayList<>();
        idList.add(1001);
        idList.add(1002);
        idList.add(1003);
//        idList=null;    //用于测试当参数为null的时候
        List<Student> students = studentDao.selectForeachOne(idList);
        System.out.println(students);
    }
}
